package zuoye2;

import java.util.*;
import java.util.stream.Collectors;

public class Test4 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list," 刘备字玄德","曹操字孟德"," 孙权字仲谋"
                ," 关羽字云长"," 张飞字翼德"," 赵云字子龙"," 乐进字文谦"," 李典字曼成"," 曹仁字子孝"," 曹洪字子廉");
        System.out.println(list);
        Map<String, String> map = list.stream().map(s -> s.split("字")).collect(Collectors.toMap(
                arr -> arr[0], arr -> arr[1]
        ));
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry);
        }


    }
}
